﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="CarInDetail.aspx.vb" Inherits="Final_Web_2._0_site_1.CarInDetail" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <style type="text/css">
        .style1
        {
            width: 100%;
        }
        .style3
        {
            width: 419px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    
      ( If you can't see the car detail below, Please rate the car first and refresh the page than information will be displayed)


        <table class="style1">
            <tr>
                <td class="style3">
        <asp:Button ID="btnBackup" runat="server" Text="Back" />
                    <br />
                    <br />
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
                        DataSourceID="CarInDetailSqlDataSource1" CellPadding="4" ForeColor="#333333" 
                        GridLines="None" Height="300px" Width="241px">
            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
            <Columns>
                <asp:TemplateField HeaderText="Picture">
                   
                 <ItemTemplate>
                 <asp:HyperLink ID="Hyperlink1" NavigateUrl ='<%# Eval("CarID", "CarImageBigView.aspx?ID={0}") %>' runat ="server">
                 <asp:Image ID="Image1" runat = "server" ImageUrl ='<%# Eval("CarPicture") %>' CssClass ="CarInDetailImageSize" /> 
                 </asp:HyperLink><br />
                 Model:  <%# Eval("CarModelName")%><br />
                 Year: <%# Eval("CarModelYear")%><br />
                 CC: <%# Eval("CC")%><br />
                 Colour: <%# Eval("CarColour")%><br />
                  User: <%# Eval("UserIDFK")%><br />
                  Average Rating: <%# Eval("AverageRating")%><br />
                 <asp:HyperLink ID="Hyperlink2" NavigateUrl = ' <%# Eval("CarInfoURL","{0}") %>' runat ="server">More
                 </asp:HyperLink>
                 </ItemTemplate>
                                  
                </asp:TemplateField>

          
            </Columns>
            <EditRowStyle BackColor="#999999" />
            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
            <SortedAscendingCellStyle BackColor="#E9E7E2" />
            <SortedAscendingHeaderStyle BackColor="#506C8C" />
            <SortedDescendingCellStyle BackColor="#FFFDF8" />
            <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
        </asp:GridView>
                    <br />
        <asp:SqlDataSource ID="CarInDetailSqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:MercedesConnectionString %>" 
            ProviderName="<%$ ConnectionStrings:MercedesConnectionString.ProviderName %>" 
            
            SelectCommand="SELECT Car.CarID, Car.CarModelName, Car.CarModelYear, Car.CC, Car.CarColour, Car.CarPicture, Car.CarInfoURL, Car.UserIDFK, AverageRating.AverageRating, AverageRating.CarIDFK FROM (Car INNER JOIN AverageRating ON Car.CarID = AverageRating.CarIDFK) WHERE (Car.CarID = ?)">
            <SelectParameters>
                 <asp:QueryStringParameter Name="CarID" QueryStringField="ID" Type="Int32" />
            </SelectParameters>
        </asp:SqlDataSource>
                    <br />
        Please leave a comment here:<br />
        <asp:TextBox ID="tbxCarComment" runat="server" Height="84px" 
            TextMode="MultiLine" Width="381px"></asp:TextBox>
                    <br />
                    <asp:Button ID="btnCarComment" runat="server" Text="Comment" />
                    <br />
                    <br />
                    <br />
                    <br />
                    <br />
                </td>
                <td>
                    <br />
      

        Rate this Car!
            
                    <br />
            
    <asp:Rating  BorderWidth="1" BorderStyle="Solid"
    width="200" 
    Height="40" 
    ID="Rating1"  
    CurrentRating="2" 
    runat="server" 
    StarCssClass="ratingStar" 
    WaitingStarCssClass="savedRatingStar" 
    EmptyStarCssClass="emptyRatingStar" 
    filledStarCssClass="filledRatingStar"
    MaxRating="5" 
    >
   
    </asp:Rating>
   

        <asp:Button ID="btn_Rating" runat="server" Text="Rate" />
                    <br />
                    <br />
                    <br />
                    <br />
                    <br />
        <asp:GridView ID="GridViewCarComment" runat="server" AutoGenerateColumns="False" 
           Height="135px" Width="384px" CellPadding="4" ForeColor="#333333" GridLines="None">
            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
            <Columns>
                <asp:TemplateField HeaderText="Comments">
                <ItemTemplate>
               
                <%# Eval("CommentBody")%><br />
                 <%# Eval("DateUploaded")%>
                  <%# Eval("TimeUploaded")%><br />
                By user  <%# Eval("UserIDFK")%><br />
                </div>
                </ItemTemplate>

                <AlternatingItemTemplate>
               
                <%# Eval("CommentBody")%><br />
                 <%# Eval("DateUploaded")%>
                  <%# Eval("TimeUploaded")%><br />
                   By user <%# Eval("UserIDFK")%><br />
                </div>
                
                </AlternatingItemTemplate>
                </asp:TemplateField>
            </Columns>
            <EditRowStyle BackColor="#999999" />
            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
            <SortedAscendingCellStyle BackColor="#E9E7E2" />
            <SortedAscendingHeaderStyle BackColor="#506C8C" />
            <SortedDescendingCellStyle BackColor="#FFFDF8" />
            <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
        </asp:GridView>
                    <br />
        <asp:SqlDataSource ID="CommentCarDetailSqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:MercedesConnectionString %>" 
            ProviderName="<%$ ConnectionStrings:MercedesConnectionString.ProviderName %>" 
            
            SelectCommand="SELECT Car_Comment.CommentBody, Car_Comment.DateUploaded, Car_Comment.TimeUploaded, Car_Comment.UserIDFK, aspnet_Users.UserName FROM (Car_Comment INNER JOIN aspnet_Users ON Car_Comment.UserIDFK = aspnet_Users.UserId)">
        </asp:SqlDataSource>
        
                    <br />
                    Please choose the Tags below to add to the car.
                    <br />
                    <br />
        <asp:CheckBoxList ID="CBLCarTags" runat="server" 
            DataSourceID="CarTagsSqlDataSource1" DataTextField="TagName" 
            DataValueField="TagID" RepeatDirection="Horizontal" RepeatLayout="Flow">
        </asp:CheckBoxList>
                    <br />
                    <br />
        Add new tags here, Please separate each tag by commas (E.g Tag1, Tag2)  
                     <br />
                    <br />
        <asp:TextBox ID="tbxAddNewTag" runat="server" Width="239px"></asp:TextBox>
                    <br />

        <asp:SqlDataSource ID="CarTagsSqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:MercedesConnectionString %>" 
            ProviderName="<%$ ConnectionStrings:MercedesConnectionString.ProviderName %>" 
            SelectCommand="SELECT [TagID], [TagName] FROM [Tags] WHERE ([TagName] &lt;&gt; ?)">
            <SelectParameters>
                <asp:Parameter DefaultValue=" " Name="TagName" Type="String" />
            </SelectParameters>
        </asp:SqlDataSource>
                    Click on the button the save the tags.<br />
        <asp:Button ID="btnTagCar" runat="server" Text="Tag " />
                </td>
            </tr>
        </table>
    



        <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
        </asp:ToolkitScriptManager>
    <br />
     <br />
        <br />
        <br />

</asp:Content>